<?php

require_once 'Zend/Validate/Abstract.php';

class Validate_EmailNotExists extends Zend_Validate_Abstract {
    const INVALID = 'emailExists';

    /**
     * Validation failure message template definitions
     *
     * @var array
     */
    protected $_messageTemplates = array(
        self::INVALID => "E-mail already exists",
    );

    /**
     * Defined by Zend_Validate_Interface
     *
     * Returns true if and only if $value contains only hexadecimal digit characters
     *
     * @param  string $value
     * @return boolean
     */
    public function isValid($value) {

        $valid = new Validate_EmailExists();

        if ($valid->isValid($value))
        {
             $this->_error(self::INVALID);
             return false;
        }

        return true;
    }

}
